<?php if ( ! defined('BASEPATH')) exit('This file does not run directly. Sorry.'); ?>
<?php
/**
 * Kalaisoo.
 *
 * A lightweight no-framework framework written in PHP.
 *
 * @package Kalaisoo
 * @author $Author: info@sah-company.com $
 */
?>
<?php
/**
 * Include the partial template that holds doctype, html, head with metas and such.
 */
$this->view('shared/head');
?>
<?php
/**
 * Include the partial template that holds avatar and navigation.
 */
$this->view('shared/avatar');
?>
<?php
/**
 * Include the partial template that holds the toolbar.
 */
$this->view('shared/toolbar');
?>
<?php
/**
 * Include the partial template that displays the header of a record.
 */
$this->view('shared/editor/toolbar');
?>
<div class="table-wrapper">
	<table>
		<caption>
			<?php echo sprintf(__('report_run_success'), count($rows)); ?>
		</caption>
		<thead>
			<tr>
				<th class="handle">&nbsp;</th>
	<?php
		$colCount = 0;
		foreach ($columns as $column):
			if (substr($column, -3, 3) == '_id') continue;
			$colCount++;
			$style = '';
			if (isset($widths[$column])) $style = ' style="width: '.($widths[$column]).'%;"';
	?>
				<th<?php echo $style ?>><?php echo htmlspecialchars(__($column.'_label')); ?></th>
	<?php
		endforeach;
	?>
			</tr>
		</thead>

		<tfoot>
			<tr>
				<td>&nbsp;</td>
				<td colspan="<?php echo $colCount; ?>"></td>
			</tr>
		</tfoot>

		<tbody>
	<?php
	foreach ($rows as $n=>$row):
		$urlToOpen = ahref(sprintf($urlToOpenPattern, $row[$record->model.'_id']));
	?>
			<tr>
				<td class="handle">
					<a
						href="<?php echo $urlToOpen; ?>"
						class="pencil">
							<span><?php echo __('open_action'); ?></span>
					</a>
				</td>
	<?php
		foreach ($columns as $column):
			if (substr($column, -3, 3) == '_id') continue;
	?>
				<td>
				<?php echo htmlspecialchars($row[$column]),"\n"; ?>
				</td>
	<?php
		endforeach;
	?>
			</tr>
	<?php
	endforeach;
	?>
		</tbody>
	</table>
</div>
<?php
/**
 * Include the partial template that closes all tags opened in @see views/shared/head.
 */
$this->view('shared/foot');
?>